package models

import (
	"github.com/zw2582/ginlib"
	"time"
)

type Bank2LogVendor struct {
	Id int `xorm:"pk autoincr"`
	Uuid string `xorm:"varchar(32)"`
	Code int `xorm:"int"`
	VendorId int `xorm:"int"`
	VendorReq string `xorm:"text"`
	VendorResp string `xorm:"text"`
	Duration int64 `xorm:"int comment('耗时（毫秒）')"`
	Error string `xorm:"text"`
	CreatedAt time.Time `xorm:"created"`
	Status int `xorm:"tinyint comment('1.正常 2.报错')"`
}

func init()  {
	ginlib.XormAddWaitSync(new(Bank2LogVendor))
}

func (this *Bank2LogVendor) Save() {
	var err error
	if this.Id == 0 {
		_, err = DB.Insert(this)
	} else {
		_, err = DB.ID(this.Id).Update(this)
	}
	if err != nil {
		panic(err)
	}
}